#!/bin/bash
PROJECT_NAME="workerman-worker"
DOCKERFILE="Dockerfile"
if [ "$1" = "" ];then
    echo "version is required!"
    exit 2
fi
IMAGE_VERSION=$1
REGISTRY_URL="registry.cn-beijing.aliyuncs.com/gaork/"${PROJECT_NAME}
docker build -f ${DOCKERFILE} -t ${PROJECT_NAME}:${IMAGE_VERSION} .
docker tag ${PROJECT_NAME}:${IMAGE_VERSION} ${REGISTRY_URL}:${IMAGE_VERSION}
docker tag ${PROJECT_NAME}:${IMAGE_VERSION} ${REGISTRY_URL}:latest
docker push ${REGISTRY_URL}:${IMAGE_VERSION}
docker push ${REGISTRY_URL}:latest
